<?php

abstract class ACoreBaseCollection
{
	#<editor-fold defaultstate="collapsed" desc="private">
	/**
	 * @var	array
	 */
	private $_aItems;
	#</editor-fold>

	/**
	 * @return	ACoreBaseCollection
	 */
	public function __construct()
	{
		$this->_aItems = array();
	}
	
	/**
	 * @return	array
	 */
	public function &GetArray()
	{
		return $this->_aItems;
	}
	
	/**
	 * @param	mixed	$mItem
	 * @return	void
	 */
	public function Add($mItem)
	{
		CCore::CheckTypes(array('$mItem'));

		$this->_aItems[] = $mItem;
	}

	/**
	 * @param	mixed	$mItem
	 * @return	void
	 */
	public function AddArray($aItems)
	{
		CCore::CheckTypes(array('$aItems'));

		if (is_array($aItems))
		{
			foreach ($aItems as $mItem)
			{
				$this->Add($mItem);
			}
		}
	}
	
	/**
	 * @return	bool
	 */
	public function Clear()
	{
		$this->_aItems = array();
		return true;
	}
	
	/**
	 * @return	int
	 */
	public function Count()
	{
		return count($this->_aItems);
	}
}
